import request from '@/utils/request'

// 查询客户信息列表
export function listCustomer(query) {
  return request({
    url: '/wms/customer/list',
    method: 'get',
    params: query
  })
}

// 查询客户信息详细
export function getCustomer(id) {
  return request({
    url: '/wms/customer/' + id,
    method: 'get'
  })
}

// 新增客户信息
export function addCustomer(data) {
  return request({
    url: '/wms/customer',
    method: 'post',
    data: data
  })
}

// 修改客户信息
export function updateCustomer(data) {
  return request({
    url: '/wms/customer',
    method: 'put',
    data: data
  })
}

// 删除客户信息
export function delCustomer(id) {
  return request({
    url: '/wms/customer/' + id,
    method: 'delete'
  })
}

// 根据客户编码查询客户信息
export function getCustomerByCode(customerCode) {
  return request({
    url: '/wms/customer/getByCode/' + customerCode,
    method: 'get'
  })
}

// 检查客户编码是否唯一
export function checkCustomerCodeUnique(customerCode, id) {
  return request({
    url: '/wms/customer/checkCustomerCodeUnique',
    method: 'post',
    data: {
      customerCode: customerCode,
      id: id
    }
  })
}

// 导出客户信息
export function exportCustomer(query) {
  return request({
    url: '/wms/customer/export',
    method: 'get',
    params: query
  })
}